home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 10571 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.9 KB  |  45 lines

  1. Newsgroups: comp.lang.c
  2. Path: news.sprintlink.net!news1!ind-005-236-220
  3. From: dlmiller@iquest.net (Doug Miller)
  4. Subject: Re: Determining the length of an int in string form
  5. X-Nntp-Posting-Host: ind-005-236-220.iquest.net
  6. Message-ID: <DoGs5D.FFB@iquest.net>
  7. Sender: news@iquest.net (News Admin)
  8. Organization: IQuest Network Services
  9. X-Newsreader: News Xpress Version 1.0 Beta #2.1
  10. References: <3146D058.DD7@cbm.com> <4i7uth$qph@inet-nntp-gw-1.us.oracle.com> <DoE38u.GIH@iquest.net>
  11. Date: Mon, 18 Mar 1996 13:03:05 GMT
  12.  
  13. dlmiller@iquest.net (Doug & Rose Miller) wrote:
  14. +Xref: news1 comp.lang.c:70898
  15. +Newsgroups: comp.lang.c
  16. +Path: news1!ts02-and-07
  17. +From: dlmiller@iquest.net (Doug & Rose Miller)
  18. +Subject: Re: Determining the length of an int in string form
  19. +X-Nntp-Posting-Host: ts02-and-07.iquest.net
  20. +Message-ID: <DoE38u.GIH@iquest.net>
  21. +Sender: news@iquest.net (News Admin)
  22. +Organization: IQuest Network Services
  23. +X-Newsreader: News Xpress Version 1.0 Beta #2.1
  24. +References: <3146D058.DD7@cbm.com> <4i7uth$qph@inet-nntp-gw-1.us.oracle.com>
  25. +Date: Sun, 17 Mar 1996 02:02:28 GMT
  26. +Lines: 14
  27. +
  28. +wkaufman@wkaufman.us.oracle.com (William Kaufman) wrote:
  29. ++In article <3146D058.DD7@cbm.com> Dave Payne <paynedc@cbm.com> writes:
  30. ++] Consider this:
  31. ++]
  32. ++] I have a variable of type int, and I would like to use the sprintf()
  33. ++] function to write this variable to a string.  However, I want to
  34. ++] dynamically allocate the space for the string, and only malloc enough
  35. ++] space to hold the int.
  36. +
  37. +WHY ???
  38. +
  39. +Even a 32-bit int is only 9 characters at most, and that's *with* the sign.  Why not just declare
  40. +a string and be done with it?  Is storage space that tight for you, that nine bytes matters?
  41. +
  42. Oops! make that 11 characters with sign -- sorry about that.  But my point remains.
  43. Even if an int is 64 bits wide, what's the big deal?  Why the burning need for dynamic allocation
  44. of only ten or twenty bytes?
  45.